package com.api.league.service;

import com.api.core.service.Service;
import com.api.league.form.BatchAddFixturesForm;
import com.api.league.form.FixtureForm;
import com.api.league.model.LeagueMatchDay;
import com.api.league.vo.LeagueFixtureVo;
import com.api.league.vo.LeagueMatchDayVo;
import com.api.league.vo.LeagueStandingVo;
import com.github.pagehelper.PageInfo;

import java.util.Date;
import java.util.List;

/**
 * @author RenQiang
 * @date 2021/5/30
 */
public interface LeagueMatchService extends Service<LeagueMatchDay> {
    /**
     * 批量添加对局
     * 若比赛日还不存在则先新增比赛日
     *
     * @param form
     */
    void batchAddFixtures(BatchAddFixturesForm form);

    /**
     * 根据ID删除对局
     *
     * @param fixtureId
     */
    void deleteFixtureById(Long fixtureId);

    /**
     * 根据ID删除比赛日
     * 同时删除比赛日下的所有对局
     *
     * @param matchDayId
     */
    void deleteMatchDayById(Long matchDayId);

    /**
     * 分页查询比赛日
     *
     * @param leagueId
     * @param pageNum
     * @param pageSize
     * @return
     */
    PageInfo<LeagueMatchDayVo> findMatchDayByPage(Long leagueId, Integer pageNum, Integer pageSize);

    /**
     * 分页查询对局
     *
     * @param leagueId
     * @param pageNum
     * @param pageSize
     * @return
     */
    PageInfo<LeagueFixtureVo> findFixtureByPage(Long leagueId, Integer pageNum, Integer pageSize);

    /**
     * 保存对局结果
     *
     * @param fixtureId
     * @param team1Score
     * @param team2Score
     */
    void saveFixtureResultAndSettle(Long fixtureId, Integer team1Score, Integer team2Score);

    /**
     * 分页查询比赛日成绩排名
     *
     * @param leagueId
     * @param beginDate
     * @param endDate
     * @param pageNum
     * @param pageSize
     * @return
     */
    PageInfo<LeagueStandingVo> findMatchDayStandingByPage(Long leagueId, Date beginDate, Date endDate, Integer pageNum, Integer pageSize);

    /**
     * 分页查询战队战绩排名
     *
     * @param leagueId
     * @param pageNum
     * @param pageSize
     * @return
     */
    PageInfo<LeagueStandingVo> findTeamStandingByPage(Long leagueId, Integer pageNum, Integer pageSize);

    /**
     * 批量修改对局
     *
     * @param fixtureForms
     */
    void batchUpdateFixtures(List<FixtureForm> fixtureForms);
}
